<div class="dataCount mt20 mb20" style="margin-left: 30px;margin-right: 30px;">
    <form  id="searchForm" action="{{url("admin/index")}}"  method="post">
        <div class="nav">
            <div  style="margin:30px 30px 0px 30px;padding-top: 10px;">
                <input type="text" name="adminId" class="seek" value="<?php echo $this->request->get('adminId'); ?>" placeholder="输入用户ID">
                <input type="text" name="role" class="seek" value="<?php echo $this->request->get('role'); ?>" placeholder="管理员角色">
                <input type="text" name="realName" class="seek" value="<?php echo $this->request->get('realName'); ?>" placeholder="真实姓名">
                <button id="search_btn" type="button">搜索</button>
                <button id="addRole_btn" type="button">角色添加</button>
                <button id="addAdmin_btn" type="button">管理员添加</button>
            </div>
            <!--            <div >
                            <p class="minTab"  style="width: 200px;margin:auto;"><a href="javascript:;" class="fir">创作文章</a><a href="javascript:;" class="curr">上传视频</a></p>
                        </div>-->
        </div>
    </form>
    <table class="list-tb">

        <tr>
            <th width="4%"><input type="checkbox"  class="ckb_manage"  />全选</th>
            <th width="4%">用户ID</th>
            <th width="5%">用户名</th>
            <th width="5%">管理员角色</th>
            <th width="5%" >真实姓名</th>
            <th width="5%" >登陆次数</th>
            <th width="5%">登陆时间</th>
            <th width="5%">登陆IP</th>
            <th width="5%">用户创建时间</th>
            <th width="5%">用户修改时间</th>
            <th width="5%">创建用户</th>
            <th width="5%">修改用户</th>
            <th width="5%">操作</th>
        </tr>
        {% if allAdminUser %}
        {% for adminUser in allAdminUser %}
        <tr>
            <td > <input type="checkbox" name="ids[]" class="ckb"  value="{{adminUser['adminId']}}" /></td>
            <td >{{adminUser['adminId']}}</td>
            <td >{{adminUser['username']}}</td>

            <td >
                {% for remark in remarks %}
                {% if adminUser['roleId'] ==  remark['id'] %}
                {{ remark['name'] }}
                {% endif %}
                {% endfor %}
            </td>

            <td >{{adminUser['realName']}}</td>
            <td >{{adminUser['loginCount']}}</td>
            <td >{{date('Y-m-d H:i:s' ,adminUser['loginTime'])}}</td>

            <td >
                {% if adminUser['loginIp'] == '' %}
                null
                {% else %}
                {{ adminUser['loginIp'] }}
                {% endif %}
            </td>

            <td >{{date('Y-m-d H:i:s' ,adminUser['createTime'])}}</td>
            <td >{{date('Y-m-d H:i:s' ,adminUser['updateTime'])}}</td>
            <td >{{adminUser['createUser']}}</td>
            <td >{{adminUser['updateUser']}}</td>
            <td  >
                {% if article['status'] == 0  %}

                {% else %}
                已审批
                {% endif %}
            </td>
        </tr>
        {% endfor %}
        {% else  %}
        <tr>
            <td colspan="13">
                <div class="noData">
                    <p class="info">没有符合条件的结果</p>
                </div>
            </td>
        </tr>
        {% endif %}
    </table>
    <div class="page mt30">
        {{ show }}
    </div>

</div>

<script>
    /*
     * 提交搜索表单
     *
     */
    var submitSearchForm = function () {
        $("#searchForm").submit();
    };

    /**
     * 添加管理员角色信息
     */
    var clickaddRoleHandle = function () {
        window.location.href = "{{url('admin/addRole')}}"
    }

    /**
     * 添加管理员
     */
    var clickaddAdminHandle = function () {
        window.location.href = "{{url('admin/addAdmin')}}"
    }

    $(window).load(function () {
        $('#search_btn').bind('click', submitSearchForm);
        $('#addRole_btn').bind('click', clickaddRoleHandle);
        $('#addAdmin_btn').bind('click', clickaddAdminHandle);
        $('.ckb_manage').click(function () {
            if ($(this).prop('checked') == true) {
                $('.ckb').prop("checked", true);
            } else {
                $('.ckb').prop("checked", false);
            }
        });
    });


</script>
